#ifndef STRUCTCELLS_HPP
#define STRUCTCELLS_HPP

#include "structCellsBase.hpp"

namespace hms {

template<>
class CellsTraits<StructCells>{
public:
	using MeshType = StructMesh;
	using AreasReturnType     = const ArrayXs&;
	using CircumfsReturnType  = const ArrayXs&;
	using CentroidsReturnType = const Matrix2Xs&;
};

class StructCells : public StructCellsBase<StructCells>
{
private:

	ArrayXs m_areas;
	Matrix2Xs m_centroids;
	ArrayXs m_circumfs;

public:
	StructCells() = default;
	StructCells( const StructMesh& );

	auto centroid(Index) const -> Matrix2Xs::ConstColXpr;
	auto area    (Index) const -> scalar;
	auto circumf (Index) const -> scalar;

private:
	StructCells( const StructMesh&, ArrayXs&& areas, Matrix2Xs&& centroids );

	auto centroidsImp() const -> const Matrix2Xs&;
	auto areasImp    () const -> const ArrayXs&;
	auto circumfsImp () const -> const ArrayXs&;

	friend StructMesh;
	friend StructCell;
	friend CellsBase;

private:
	void storeData();
};

}

#endif